package com.zygh.lz.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zygh.lz.dao.EquipageMapper;
import com.zygh.lz.entity.query.EquipageQuery;
import com.zygh.lz.entity.vo.EquipageVO;
import com.zygh.lz.service.PoliceEquipmentService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @program: zygh-transform
 * @description: 装备信息
 * @author: jhaol
 * @created: 2023/06/06 13:58
 */
@Service
public class PoliceEquipmentServiceImpl implements PoliceEquipmentService {

    @Resource
    private EquipageMapper equipageMapper;

    @Override
    public PageInfo<EquipageVO> getEquipmentList(EquipageQuery equipageQuery) {
        if (equipageQuery.getPageNum() == null) {
            equipageQuery.setPageNum(0);
        }
        if (equipageQuery.getPageSize() == null || equipageQuery.getPageSize() == 0) {
            equipageQuery.setPageSize(10);
        }
        PageHelper.startPage(equipageQuery.getPageNum(), equipageQuery.getPageSize());
        List<EquipageVO> equipmentList = equipageMapper.getEquipmentList(equipageQuery);
        PageInfo<EquipageVO> equipageVOPageInfo = new PageInfo<>(equipmentList);
        return equipageVOPageInfo;
    }
}
